const { DataTypes } = require('sequelize')

module.exports = (sequelize) => {
  const TableTheme = sequelize.define('TableTheme', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    theme_id: {
      type: DataTypes.STRING(50),
      allowNull: false,
      unique: true,
      comment: '主题唯一标识'
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: '主题名称'
    },
    description: {
      type: DataTypes.TEXT,
      comment: '主题描述'
    },
    colors: {
      type: DataTypes.JSON,
      comment: '颜色配置'
    },
    fonts: {
      type: DataTypes.JSON,
      comment: '字体配置'
    },
    spacing: {
      type: DataTypes.JSON,
      comment: '间距配置'
    },
    is_default: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
      comment: '是否为默认主题'
    },
    status: {
      type: DataTypes.ENUM('active', 'inactive'),
      defaultValue: 'active',
      comment: '状态'
    },
    created_by: {
      type: DataTypes.INTEGER,
      comment: '创建者ID'
    }
  }, {
    tableName: 'table_themes',
    comment: '动态表格主题配置表'
  })

  return TableTheme
}